<?php
class Gangnet_Model_GnUser
{
/**         GN_USER TABLE
 *  +----+--------------+-----------+---------------+------------+------------+----------------+-------------+-------------+
 *  | id | account      | password  | name          | roster_pd1 | roster_pd2 | specialization | skills_link | games_owned |
 *  +----+--------------+-----------+---------------+------------+------------+----------------+-------------+-------------+
 */
    protected $_id;
    protected $_account;
    protected $_password;
    protected $_name;
    protected $_roster_pd1;
    protected $_roster_pd2;
    protected $_specialization;
    protected $_skills_link;
    protected $_games_owned;

    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }

    public function __set($name, $value)
    {
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid property');
        }
        $this->$method($value);
    }

    public function __get($name)
    {
        $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid property');
        }
        return $this->$method();
    }

    public function setOptions(array $options)
    {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }

    public function getId()
    {
        return $this->_id;
    }

    public function getAccount()
    {
        return $this->_account;
    }

    public function getPassword()
    {
        return $this->_password;
    }


    public function getName()
    {
        return $this->_name;
    }

    public function getRosterPD1()
    {
        return $this->_roster_pd1;
    }

    public function getRosterPD2()
    {
        return $this->_roster_pd2;
    }

    public function getSpecialization()
    {
        return $this->_specialization;
    }

    public function getSkillsLink()
    {
        return $this->_skills_link;
    }

    public function getGamesOwned()
    {
        return $this->_games_owned;
    }

    public function setId($id)
    {
        $this->_id = (int) $id;
        return $this;
    }

    public function setAccount($text)
    {
        $this->_account = (string) $text;
        return $this;
    }

    public function setPassword($text)
    {
        $this->_password = (string) $text;
        return $this;
    }

    public function setName($text)
    {
        $this->_name = (string) $text;
        return $this;
    }

    public function setRosterPD1($text)
    {
        $this->_roster_pd1 = (string) $text;
        return $this;
    }

    public function setRosterPD2($text)
    {
        $this->_roster_pd2 = (string) $text;
        return $this;
    }

    public function setSpecialization($text)
    {
        $this->_specialization = (string) $text;
        return $this;
    }

    public function setSkillsLink($text)
    {
        $this->_skills_link = (string) $text;
        return $this;
    }

    public function setGamesOwned($text)
    {
        $this->_games_owned = (string) $text;
        return $this;
    }
}